import BaseUtil from '@/BaseUtil';
import MovementCommon from 'code/Core/Common/MovementCommon';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 刚毛飞射
 **/
export default class BossSpell_GangMao extends AbilityBase {
    static instance: BossSpell_GangMao;
    constructor(id: string = 'Mzt2') {
        super(id);
        BossSpell_GangMao.instance = this;
        this.init();
        se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
    }
    init() {}
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        BossAbilityManagerInstance.text('刚毛飞射', source);
        BaseUtil.runLater(1, () => {
            for (let i = 0; i < 36; i++) {
                let ag = 10 * i;
                MovementCommon.LineMissile({
                    caster: source,
                    distance: 600,
                    speed: 600,
                    angle: ag,
                    missile: 'Abilities\\Weapons\\PoisonArrow\\PoisonArrowMissile.mdl',
                    radius: 75,
                    onHit: this.hit.bind(this),
                });
            }
            source = null;
        });
    }
    hit(p: LineMissileConfig, hit: unit) {
        DamageSystemInstance.applyPhysicalDamage(hit, p.caster, 800);
        DestroyEffect(AddSpecialEffectTarget('Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl', hit, 'origin'));
    }
    onSpellEffect() {
        this.cast(GetSpellTargetX(), GetSpellTargetY(), GetTriggerUnit(), GetSpellTargetUnit());
    }
}
